<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

  <title>Class: TC_Card</title>

  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

  <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="./TC_Card_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="TC_Card.rb">TC_Card.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link">Test::Unit::TestCase</p>
        
      </div>
      

      

      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-i-test_find_jack_of_hearts">#test_find_jack_of_hearts</a></li>
          
          <li><a href="#method-i-test_initialize">#test_initialize</a></li>
          
          <li><a href="#method-i-test_ranks">#test_ranks</a></li>
          
          <li><a href="#method-i-test_to_string">#test_to_string</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="./images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="./Card.html">Card</a></li>
        
          <li><a href="./CardList.html">CardList</a></li>
        
          <li><a href="./Deck.html">Deck</a></li>
        
          <li><a href="./Hand.html">Hand</a></li>
        
          <li><a href="./Object.html">Object</a></li>
        
          <li><a href="./Pile.html">Pile</a></li>
        
          <li><a href="./Player.html">Player</a></li>
        
          <li><a href="./Poker.html">Poker</a></li>
        
          <li><a href="./TC_Card.html">TC_Card</a></li>
        
          <li><a href="./TC_Deck.html">TC_Deck</a></li>
        
          <li><a href="./TC_Hand.html">TC_Hand</a></li>
        
          <li><a href="./TC_Pile.html">TC_Pile</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">TC_Card</h1>

    <div id="description" class="description">
      
    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      

      <!-- Methods -->
      
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="test_find_jack_of_hearts-method" class="method-detail ">
          <a name="method-i-test_find_jack_of_hearts"></a>

          
          <div class="method-heading">
            <span class="method-name">test_find_jack_of_hearts</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="test_find_jack_of_hearts-source">
<pre>
<span class="ruby-comment"># File TC_Card.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_find_jack_of_hearts</span>
  <span class="ruby-identifier">found</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">jack_of_hearts</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:HEARTS</span>, <span class="ruby-value">:JACK</span>)
  <span class="ruby-keyword">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">found</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">card</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SUITS</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-value">4</span>)], <span class="ruby-constant">KINDS</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-value">13</span>)])
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">card</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">jack_of_hearts</span>
      <span class="ruby-identifier">found</span>=<span class="ruby-keyword">true</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">found</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- test_find_jack_of_hearts-source -->
            
          </div>

          

          
        </div><!-- test_find_jack_of_hearts-method -->

      
        <div id="test_initialize-method" class="method-detail ">
          <a name="method-i-test_initialize"></a>

          
          <div class="method-heading">
            <span class="method-name">test_initialize</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="test_initialize-source">
<pre>
<span class="ruby-comment"># File TC_Card.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_initialize</span>
  <span class="ruby-identifier">my_card</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:SPADES</span>, <span class="ruby-value">:TWO</span>
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">my_card</span>.<span class="ruby-identifier">suit</span>, <span class="ruby-value">:SPADES</span>)
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">my_card</span>.<span class="ruby-identifier">kind</span>, <span class="ruby-value">:TWO</span>)
  
  <span class="ruby-identifier">my_card</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:HEARTS</span>, <span class="ruby-value">:ACE</span>
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">my_card</span>.<span class="ruby-identifier">suit</span>, <span class="ruby-value">:HEARTS</span>)
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">my_card</span>.<span class="ruby-identifier">kind</span>, <span class="ruby-value">:ACE</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- test_initialize-source -->
            
          </div>

          

          
        </div><!-- test_initialize-method -->

      
        <div id="test_ranks-method" class="method-detail ">
          <a name="method-i-test_ranks"></a>

          
          <div class="method-heading">
            <span class="method-name">test_ranks</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="test_ranks-source">
<pre>
<span class="ruby-comment"># File TC_Card.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_ranks</span>
  <span class="ruby-identifier">two_of_clubs</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:CLUBS</span>, <span class="ruby-value">:TWO</span>
  <span class="ruby-identifier">three_of_clubs</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:CLUBS</span>, <span class="ruby-value">:THREE</span>
  <span class="ruby-identifier">three_of_diamonds</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:DIAMONDS</span>, <span class="ruby-value">:THREE</span>
  <span class="ruby-identifier">ace_of_spades</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:SPADES</span>, <span class="ruby-value">:ACE</span>
  <span class="ruby-identifier">jack_of_hearts</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:HEARTS</span>, <span class="ruby-value">:JACK</span>
  <span class="ruby-identifier">jack_of_spades</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:SPADES</span>, <span class="ruby-value">:JACK</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">jack_of_hearts</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">three_of_diamonds</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">jack_of_hearts</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">jack_of_hearts</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">jack_of_spades</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">jack_of_hearts</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">three_of_diamonds</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">three_of_clubs</span>
  <span class="ruby-identifier">assert</span> <span class="ruby-identifier">three_of_clubs</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">three_of_diamonds</span>
  <span class="ruby-comment"># test two_of_clubs is worst, ace_of_spades is best</span>
  <span class="ruby-value">500</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">random_card</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SUITS</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-constant">SUITS</span>.<span class="ruby-identifier">length</span>)], <span class="ruby-constant">KINDS</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-constant">KINDS</span>.<span class="ruby-identifier">length</span>)])
    <span class="ruby-identifier">assert</span> <span class="ruby-identifier">two_of_clubs</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">random_card</span>
    <span class="ruby-identifier">assert</span> <span class="ruby-identifier">random_card</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">two_of_clubs</span>
    <span class="ruby-identifier">assert</span> <span class="ruby-identifier">ace_of_spades</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">random_card</span>
    <span class="ruby-identifier">assert</span> <span class="ruby-identifier">random_card</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">ace_of_spades</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- test_ranks-source -->
            
          </div>

          

          
        </div><!-- test_ranks-method -->

      
        <div id="test_to_string-method" class="method-detail ">
          <a name="method-i-test_to_string"></a>

          
          <div class="method-heading">
            <span class="method-name">test_to_string</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="test_to_string-source">
<pre>
<span class="ruby-comment"># File TC_Card.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_to_string</span>
  <span class="ruby-identifier">my_card</span> = <span class="ruby-constant">Card</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">:HEARTS</span>, <span class="ruby-value">:TEN</span>
  <span class="ruby-identifier">str</span> = <span class="ruby-identifier">my_card</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">str</span>, <span class="ruby-node">&quot;#{my_card.kind} of #{my_card.suit}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- test_to_string-source -->
            
          </div>

          

          
        </div><!-- test_to_string-method -->

      
      </div><!-- public-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

